package com.durian.finance.service.impl;

import com.durian.common.core.utils.DateUtils;
import com.durian.finance.mapper.BusinessMapper;
import com.durian.finance.service.IBusinessService;
import com.durian.financial.api.domain.Business;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 商户Service业务层处理
 * 
 * @author durian
 * @date 2022-06-22
 */
@Service
public class BusinessServiceImpl implements IBusinessService 
{
    @Autowired
    private BusinessMapper businessMapper;

    /**
     * 查询商户
     * 
     * @param id 商户主键
     * @return 商户
     */
    @Override
    public Business selectBusinessById(Long id)
    {
        return businessMapper.selectBusinessById(id);
    }

    /**
     * 查询商户列表
     * 
     * @param business 商户
     * @return 商户
     */
    @Override
    public List<Business> selectBusinessList(Business business)
    {
        return businessMapper.selectBusinessList(business);
    }

    /**
     * 新增商户
     * 
     * @param business 商户
     * @return 结果
     */
    @Override
    public int insertBusiness(Business business)
    {
        business.setCreateTime(DateUtils.getNowDate());
        return businessMapper.insertBusiness(business);
    }

    /**
     * 修改商户
     * 
     * @param business 商户
     * @return 结果
     */
    @Override
    public int updateBusiness(Business business)
    {
        return businessMapper.updateBusiness(business);
    }

    /**
     * 批量删除商户
     * 
     * @param ids 需要删除的商户主键
     * @return 结果
     */
    @Override
    public int deleteBusinessByIds(Long[] ids)
    {
        return businessMapper.deleteBusinessByIds(ids);
    }

    /**
     * 删除商户信息
     * 
     * @param id 商户主键
     * @return 结果
     */
    @Override
    public int deleteBusinessById(Long id)
    {
        return businessMapper.deleteBusinessById(id);
    }
}
